<?php

class Gallery_Service_Backend_Positions extends Kernel_Filter 
{
    
    public function process() 
    {
        $request = Application::getRequest();
        
        $id = (int)$request->get('id');
        $parent_id = (int)$request->get('parent_id');
        
        $positions = Gallery_Backend_Utils::positions($id, $parent_id);
        $position = Gallery_Backend_Utils::position($parent_id, $id);
        
        Application::getResponse()->assign(array(
            'positions' => $positions, 
            'position' => 0 == $position ? count($positions) : $position 
            ));
    }
    
}